//
//  LKHardwareViewController.m
//  Mideleague_Shop
//
//  Created by Zhiwang on 2020/7/9.
//  Copyright © 2020 Zhiwang. All rights reserved.
//

#import "LKHardwareViewController.h"
#import "LKMIneListCell.h"
#import "LKShopCloudViewController.h"
#import "LKShopTreasureViewController.h"
@interface LKHardwareViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)LKBaseTableview *tableView;
@property(nonatomic,strong)NSArray *titlesArray;
@property(nonatomic,strong)NSArray *picturesArray;
@end

@implementation LKHardwareViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"硬件管理";
    self.titlesArray = @[@[@"商家宝"],@[@"云喇叭"]];
    self.picturesArray = @[@[@"ic_hardware_pos"],@[@"ic_hardware_cloud_bugle"]];
    [self createMytable];
    // Do any additional setup after loading the view.
}
-(void)createMytable{
    self.tableView = [LKBaseTableview setTableviewWithFrame:CGRectZero style:UITableViewStyleGrouped registercellClasss:@[@"LKMIneListCell"]];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    [self.view addSubview:_tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.view);
        make.top.equalTo(self.view).offset(NAVIGATION_BAR_HEIGHT);
        make.bottom.equalTo(self.view).offset(0);
    }];
       if (@available(iOS 11.0, *)) {
        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    } else {
        // Fallback on earlier versions
    }
    [self.tableView reloadData];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.titlesArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    NSArray *titlesArray = self.titlesArray[section];
    return titlesArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    LKMIneListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKMIneListCell"];
    cell.pictureImageV.image = [UIImage imageNamed:self.picturesArray[indexPath.section][indexPath.row]];
    cell.mylabel.text = self.titlesArray[indexPath.section][indexPath.row];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 52.0f;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return [[UIView alloc] init];
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10.0f;

}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *footerView = [[UIView alloc] init];
    return footerView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 1.0f;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        LKShopTreasureViewController *vc = [[LKShopTreasureViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
    if (indexPath.section == 1) {
        LKShopCloudViewController *vc = [[LKShopCloudViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
